<div class="_contro">
    <a href="/home/goods/create?id=<?php echo $item['id'];?>&store_id=<?php echo $item['store_id']?>&copy=1" class="_a"><font style='font-size:1.5rem'>复制商品</font></a>
    <a href="/home/goods/" class="_a"><font style='font-size:1.5rem'>返回列表页</font></a>
</div>
<div class='_cut'></div>
<div class='content'>
<form action='/home/goods/submit' method='post'  id='form'>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >店铺:</label>
            <input id="store_id" name="store_id" type='text' readonly="readonly"  value='<?php echo $store['name'];?>' > 
               
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品名称:</label>
            <input type="text" class="row _minput" name='name' readonly="readonly" placeholder="" value="<?php echo $item['name'];?>"/>
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品小标题:</label>
            <input type="text" class="row _minput" name='title' readonly="readonly" placeholder="" value="<?php echo $item['title'];?>"/>
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品种类:</label>
            <input id="type" name="type" class="_select valid" value="<?php if($item['type'] == 0){ echo '剪发类';}elseif($item['type'] == 1){ echo '烫染类';}elseif($item['type'] == 2){ echo '护理类';}elseif($item['type'] == 3){ echo '仪器类';}elseif($item['type'] == 4){ echo '人工类';}?>" >
               
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品类型:</label>
            <input id="type_meal" name="is_meal_set" value="<?php if($item['is_meal_set'] == 0){ echo '单品';}elseif($item['is_meal_set'] == 1){echo '套餐';}?> " >
               
        </div>
    </div>
    <!--下面的div 当是套餐是显示-->
    <div id='meal' style='display:none' >
        <div>
            <div class="form-group row">
                <label for="exampleInputName2" class="_label" >商品:</label>
                <select id="meal_set2" name="meal_set[]" class="_select valid">

                </select>
                &nbsp;&nbsp;&nbsp;&nbsp;
                数量：<input type="text" name="num[]"  id='num2' style="width:5rem;">
            </div>
        </div>
        <div>
            <div class="form-group row">
                <label for="exampleInputName2" class="_label" >&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <select id="meal_set1" name="meal_set[]"  class="_select valid">

                </select>
                &nbsp;&nbsp;&nbsp;&nbsp;
                数量：<input type="text" name="num[]" id='num1' style="width:5rem;">
            </div>
        </div>
        <div>
            <div class="form-group row">
                <label for="exampleInputName2" class="_label" >&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <select id="meal_set0" name="meal_set[]" class="_select valid">

                </select>
                &nbsp;&nbsp;&nbsp;&nbsp;
                数量：<input type="text" name="num[]" id='num0' style="width:5rem;">
            </div>
        </div> 
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品价格:</label>
            <input type="text"  name='price' placeholder="" value="<?php echo ($item['price']/100);?>" style='width:5%' readonly="readonly" >&nbsp;元
        </div>
    </div>
    <div>
        <div class="form-group row">
            <label for="exampleInputName2" class="_label" >商品成员:</label>
            <?php $members = json_decode($item['level']); if($members){ ?>
            <input name="member" type="radio" value="0"  <?php if(in_array(0,$members)){ echo 'checked ';} ?> >全部成员&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
            <input name="member" type="radio" value="1"  <?php if(!in_array(0,$members)){ echo 'checked ';} ?> />指定成员
            <?php }else{?>
            <input name="member" type="radio" value="0"  checked >全部成员&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
            <input name="member" type="radio" value="1"   />指定成员
            <?php } ?>
        </div>
        <div id='members' style='display:none' >
            <label for="exampleInputName2" class="_label" ></label>
            <label><input name="members[]" type="checkbox" value="6" <?php if(in_array(6,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级助理 </label>&nbsp;&nbsp;
            <label><input name="members[]" type="checkbox" value="1" <?php if(in_array(1,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级发型师 </label>&nbsp;&nbsp;
            <label><input name="members[]" type="checkbox" value="2" <?php if(in_array(2,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级总监 </label>&nbsp;&nbsp;
            <div>
            <label for="exampleInputName2" class="_label" ></label>
            <label><input name="members[]" type="checkbox" value="3" <?php if(in_array(3,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级顾问 </label>&nbsp;&nbsp;
            <label><input name="members[]" type="checkbox" value="4" <?php if(in_array(4,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级美容师 </label>&nbsp;&nbsp;
            <label><input name="members[]" type="checkbox" value="5" <?php if(in_array(5,$members)){ echo 'checked="checked" ';} ?> />&nbsp;高级经理 </label>&nbsp;&nbsp;
            </div>
        </div>
    </div>
    <div>
        <div class='form-group row'>
                <label for="exampleInputName2" class="_label">商品图:</label>
                <?php if($item['id']>0){ foreach($item['images'] as $k=>$v){ ?>
                <img src="<?php echo 'http://'.IMAGE_DOMAIN.$item['images'][$k]['image'];?>" style="width:15rem;height: 15rem;border:1px;border-color: black" id="_banner_"/>
                <?php } }else{?>
                <img src="<?php echo 'http://'.IMAGE_DOMAIN.'/upload/product.png';?>" style="width:20rem;height:20rem;border:1px;border-color: black" id="_banner_"/>
                <?php }?>
       </div>
    </div>
        <div class='form-group row'>
            <div><label for="exampleInputName2" class="_label">商品介绍:</label></div>
                <label for="exampleInputName2" class="_label"></label>
                <textarea name='intro' id="_intro" class="_textarea" style="width:40%" readonly="readonly" ><?php echo $item['intro']; ?></textarea>
        </div>
        <div class="form-group _submit_div row">
                <input name='id' type='hidden' value="<?php echo $item['id'];?>"/>
                <input name='item_number' type='hidden' value="<?php echo $item['item_number'];?>"/>
        </div>
</form>

</div>
<script type="text/javascript">
    $(document).ready(function () {  
        type_meal = "<?php echo $item['is_meal_set']; ?>" ;
        if(type_meal==1){  
            $('#meal').show();
            store_id = "<?php echo $item['store_id']; ?>";
            item_number = "<?php echo $item['item_number'] ?>";
            var id = "<?php echo $item['id'] ?>";   
            $.ajax({
                url:"/home/goods/getMealSetByMember?store_id="+store_id+"&item_number="+item_number+"&id="+id,
                async: true,
                success: function (data) {
                    if(data=='false'){
                        return;
                    }
                    data = eval('(' + data + ')');
                    $.each(data, function (i, v) {
                        var str = "<option value='"+v.id+"' checked >"+v.name+"</option>";
                        $('#num'+i).val(v.number);
                        $('#meal_set'+i).html(str);
                    });
                }
            });
        }
        if($('input:radio[name="member"]:checked').val()==1){
            $('#members').show();
        }

        
    });

    

</script>